package win.smartown.kotlin.grammar

/**
 * Created by Smartown(<a href='https://github.com/smartown'>@Smartown</a>) on 2017/6/3.
 *
 * 使用字符串模板
 */
fun main(args: Array<String>) {
    useStringModule()
}

fun useStringModule() {
    var a = 1
    //使用变量名作为模板
    val s1 = "a is $a"
    a = 2
    //使用表达式作为模板
    val s2 = "${s1.replace("is", "was")}, but now is $a"
    println(s1)
    println(s2)
}